// Default empty project template
#ifndef MESBBJH_HPP_
#define MESBBJH_HPP_



#include <QString>
#include <QStringList>
#include <bb/cascades/ActivityIndicator>
#include <bb/cascades/ListView>
#include <bb/multimedia/MediaPlayer>
#include <QObject>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/Color>
#include <bb/cascades/Container>
#include <bb/cascades/DockLayout>
#include <bb/cascades/ImageView>
#include <bb/cascades/Page>
#include <bb/cascades/Slider>
#include <bb/cascades/Stacklayout>
#include <bb/cascades/StackLayoutProperties>
#include <bb/cascades/AbsoluteLayoutProperties>
#include <bb/cascades/Label>
#include <QTimer>
#include "ShowText.h"
#include <bb/cascades/TouchBehavior>
#include <bb/cascades/TouchEvent>
#include <QList>
#include <QGlobal.h>
#include <QTime>
#include <bb/cascades/ParallelAnimation>
#include <bb/cascades/TranslateTransition>
#include <bb/cascades/FadeTransition>

using namespace bb::cascades;
namespace bb { namespace cascades { class Application; }}

typedef struct lyricItem {
	long timeStart;
	QString content;
	bool success;
	};

/*!
 * @brief Application pane object
 *
 *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
 */
class MESBBJH : public QObject
{
    Q_OBJECT
public:
    MESBBJH(bb::cascades::Application *app);
    virtual ~MESBBJH() {}

private:
    void createLayout();
    bb::cascades::AbstractPane *root;

private slots:
    void update();
    void showLog(QString msg);
    void processRlC(QString s);
private:
    QList<bb::cascades::Container*> cList;
    QList<ShowText*> textList;

//    QList<ShowText*> gamePlayList;
    QTimer *timer;
    int index;
    int interval;
    long nowTime;
    int containerNow;
    int score;
    lyricItem* mLyricItems;
    int lenghtItem;
    void addTouchHandler();
    void findOtherContainer();
    void createTempData();
    int randInt(int low, int high);
    void setTextForContainer(QString text, int cIndex);
    void shakeForFail(int index);
    void createTimer();
    /**
     * Duc: cap nhap cho man hinh load list
     */
	QStringList linkTitle;
	int indextMusic;

public:
    Q_INVOKABLE void changeText(int x, int y);
    Q_INVOKABLE void handleTouch(int x, int y);
    Q_INVOKABLE void pushMainGame();
    /**
         * Duc: cap nhap cho man hinh load list
         */
    Q_INVOKABLE void loadListMusic(QString offset);

};


#endif /* MESBBJH_HPP_ */
